import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    count: 1
  },
  getters: {
    getCount: state => {
      return state.count;
    }
  },
  mutations: {
    syncIncrement(state, payload) {
      state.count += payload;
    }
  },
  actions: {
    asyncIncrement(context, payload) {
      setTimeout(() => {
        context.commit('syncIncrement', payload);
      }, 300);
    }
  },
  module: {
    foo: {
      state: {},
      getters: {},
      mutations: {},
      actions: {}
    }
  }
});